<?php

class Rcp_AuthData_Email implements Rcp_AuthData_ILoginData {
	
	private $email;
	private $password;
	
	public function __construct($email, $password) {
		$this->email = $email;
		$this->password = $password;
	}
	
	public function getUser() {
		return RcpUsersQuery::create()
		->findOneByLoginDataWithBaseData($this->email, $this->crypt($this->password));
	}
	
	public function getId() {
		return $this->email;
	}
	
	private function crypt($data) {
		return hash('sha256', $this->password);
	}
	
}